package com.ziyueyuwen.xiniao.service;

import com.ziyueyuwen.xiniao.base.exception.nullpoint.CourseNotExistException;
import com.ziyueyuwen.xiniao.bean.ZyCourseInfo;

import com.ziyueyuwen.xiniao.bean.ao.CourseSaveAO;
import com.ziyueyuwen.xiniao.bean.page.PageData;
import com.ziyueyuwen.xiniao.bean.query.CourseQuery;
import com.ziyueyuwen.xiniao.bean.vo.ZyCourseVO;

/**
 * @author wancheng  on 2018/12/17.
 */
public interface CourseService {
    /**
     * 保存课程
     * @param course
     * @return
     */
    ZyCourseInfo saveCourse(CourseSaveAO course);

    /**
     * 修改课程
     * @param course
     * @return
     * @throws Exception
     */
    ZyCourseInfo updateCourse(CourseSaveAO course) throws Exception;

    /**
     * 主键获取课程
     * @param courseId
     * @return
     */
    ZyCourseInfo getByPreKey(Integer courseId);

    /**
     * 筛选课程
     * @param query
     * @param page
     * @param rows
     * @return
     */
    PageData<ZyCourseVO> getAllZyCourse(CourseQuery query, Integer page, Integer rows);

    /**
     * 题库管理中的课程列表
     * @param query
     * @return
     */
    PageData<ZyCourseVO> getCourseForQuestion(CourseQuery query);

    /**
     * 获取课程
     * @param courseId
     * @return
     */
    ZyCourseVO getByCourseId(Integer courseId);

    /**
     * 课程的课节数自增
     * @param courseId
     * @throws CourseNotExistException
     */
    void updateCourseLessonCountIdentity(Integer courseId) throws CourseNotExistException;

    /**
     * 删除空课程(指未创建班级的课程)
     * @param courseId Integer
     * @return Boolean
     */
    Boolean deleteEmptyCourseByCourseId(Integer courseId);

}
